home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 30
/
Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso
/
Aminet
/
game
/
actio
/
Wreckage_src.lha
/
Source
/
Assembly
/
asm_3D_B_mul.asm
< prev
next >
Wrap
Assembly Source File
|
1998-06-30
|
2KB
|
165 lines
; a0 &ox
; a1 &oy
; a2 &oz
; a3 &oapp
; a4 &sincache
; d0 templong
; sincache(0)=cvaz*32767
; sincache(1)=svaz*32767
; sincache(2)=cvax*32767
; sincache(3)=svax*32767
; sincache(4)=cvay*32767
; sincache(5)=svay*32767
;A5-A7 MUST NOT BE TRASHED!!!
MOVE.l a6 ,-(a7) ;PUSH a5
MOVE.l d1 ,a6 ;load new value
_rot_loop1:
MOVE.b (a3)+ ,d1 ;oapp
BEQ _hide_point2 ;(oapp=0)=> skip point
;Main Code :)
;--------
MOVE.w (a4) ,d6 ;get cos
MOVE.w 2(a4) ,d7 ;get sin
MOVE.l (a0)+ ,d1 ;d1=ox(n)
CLR.w d1
SWAP d1
MOVE.w d1 ,d2 ;d2=x
MULS.w d6 ,d1 ;x*csa
MULS.w d7 ,d2 ;x*sna
MOVE.l (a1)+ ,d3 ;oy(n)
CLR.w d3
SWAP d3
MOVE.w d3 ,d4 ;y
MULS.w d7 ,d3 ;y*sna
SUB.l d3 ,d1 ;x*csa-y*sna
MULS.w d6 ,d4 ;y*csa
ADD.l d2 ,d4 ;y*csa+x*sna
;d4 holds Y
;d1 holds X
_rot_loop2:
; yy=y*cvax-z*svax
; zz=z*cvax+y*svax
MOVE.w 4(a4) ,d6 ;get cos
MOVE.w 6(a4) ,d7 ;get sin
MOVE.l (a2)+ ,d5 ;d2=oz(n)
CLR.w d5
SWAP d5
MOVE.w d5 ,d2 ;d2=z
MULS.w d6 ,d5 ;z*csa
MULS.w d7 ,d2 ;z*sna
CLR.w d4
SWAP d4
MOVE.w d4 ,d3 ;y is still here
; <grin>
MULS.w d6 ,d3 ;y*csa
SUB.l d2 ,d3 ;yy=y*csa-z*sna
MULS.w d7 ,d4 ;y*sna
ADD.l d5 ,d4 ;zz=z*csa+y*sna
; X D1
; Z D4
; Y D3 (do not trash)
; -----------------
_rot_loop3:
; xx=x*cvay-z*svay
; zz=z*cvay+x*svay
MOVE.w 8(a4) ,d6 ;get cos
MOVE.w 10(a4) ,d7 ;get sin
CLR.W d4
SWAP d4
MOVE.w d4 ,d2 ;d2=z (yes, it is still here)
MULS.w d6 ,d4 ;z*csa
MULS.w d7 ,d2 ;z*sna
CLR.w d1
SWAP d1
MOVE.w d1 ,d5 ;x is still here ; (I hope)
MULS.w d6 ,d1 ;x*csa
SUB.l d2 ,d1 ;xx=x*csa-z*sna
MULS.w d7 ,d5 ;x*sna
ADD.l d4 ,d5 ;zz=z*csa+x*sna
; X D1
; Y D3
; Z D5
; And do the 2d->3d Projection
CLR.w d3 ;d3 is a longword..
SWAP d3 ;but it is no more
TST.w d3
BLE _hide_point
MOVE.w #30000 ,d4 ;use approximate DIV
SUB.w d3 ,d4 ;for 3d..
ASR.l #8 ,d4
MULS.w d4 ,d1
ASR.l #8 ,d1
ASR.l #1 ,d1
ADD.w #160 ,d1
MULS.w d4 ,d5 ;and this is z
ASR.l #8 ,d5
ASR.l #1 ,d5
ADD.l #80 ,d5
MOVE.w #1 ,d7 ;display point!!
BRA _loop_ending
_hide_point2:
ADDQ.l #4 ,a0
ADDQ.l #4 ,a1
ADDQ.l #4 ,a2
_hide_point:
CLR.w d7
_loop_ending:
MOVE.w d1 ,(a6)+ ;sx
MOVE.w d5 ,(a6)+ ;sy
MOVE.w d7 ,(a6)+ ;app
SUBQ.l #1 ,d0 ;n=n-1
BGT _rot_loop1
MOVE.l (a7)+ ,a6 ;POP A5